package com.apes.fn.business.insurance.modle;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.framework.util.ApesConst;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @ClassName : InsuranceOrderItem
 * @Description : 保险订单明细
 * @Author : WSJ
 * @Date: 2020-05-19 20:17
 */
@Setter
@Getter
@Entity
@SelectBeforeUpdate
@EntityListeners(DefaultPersistListener.class)
@Table(name = InsuranceOrderItem.CONST_TABLE_NAME)
@DynamicInsert
@DynamicUpdate
public class InsuranceOrderItem extends BaseModel {
    public static final String CONST_TABLE_NAME = "insurance_order_item";

    @Id
    @Column(name = "id", nullable = false)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "保险订单明细", padding = 6)
    @Comment("编号")
    private String id;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "insurance_Order",nullable = false,referencedColumnName = "id")
    private InsuranceOrder insuranceOrder;

    @Comment("险种名称")
    @Column(name = "name" ,length = 64)
    private  String name;

    @Comment("保险价格")
    @Column(name = "insurance_Price",nullable = false,columnDefinition = ApesConst.FIELD_MONEY_16_4_0)
    private Double insurancePrice ;

}
